<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>文件分分享工具</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" th:href="@{/assert/css/base.css}">
</head>
<body>
<div class="head">
    <h1 style="top: 30% ;left: 5% ">首页</h1>
</div>
<div class="body">
    <input type="file"  id="file-uploader">
    <button onclick="uploadFile()">上传</button>
    <input id="status" value="未上传"/>
</div>
</div>
</body>
<script type="text/javascript" th:src="@{/assert/js/ajax.js}"></script>
<script>
    function uploadFile() {

        let fileInput = document.getElementById('file-uploader');

        ajaxFile(fileInput, 'https://bayfiles.com/', (data) => {
            document.getElementById('status').value = '已上传';
            console.log(data);
        });
        document.getElementById('status').value = '上传中';
    }

</script>
</html>